package com.example.redis.controller;

import com.example.redis.annoa.AutoIdempotent;
import com.example.redis.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/MyController")
public class MyController {

    @Autowired
    TokenService tokenService;

    @RequestMapping("/hello")
    @ResponseBody
    public String hello(){
        return "hello";
    }

    @GetMapping("/getToken")
    @ResponseBody
    public String getToken(){
        return tokenService.createToken();
    }

    @PostMapping("/hi1")
    @AutoIdempotent
    @ResponseBody
    public String hi1(){
        return "hi1";
    }

    @PostMapping("/hi2")
    @ResponseBody
    public String hi2(){
        return "hi2";
    }

}
